package com.ruoyi.system.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.system.domain.dto.SubscribeLookHouseDto;
import com.ruoyi.system.domain.vo.SubscribeLookHouseVo;
import com.ruoyi.system.mapper.SubscribeLookHouseMapper;
import com.ruoyi.system.service.ISubscribeLookHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class SubscribeLookHouseServiceImpl implements ISubscribeLookHouseService {

    @Autowired
    private SubscribeLookHouseMapper subscribeLookHouseMapper;


    @Override
    public Map getSubscribeLookHouseList(SubscribeLookHouseDto sub) {

        PageHelper.startPage(sub.getPageNum(),sub.getPageSize());
        Page<SubscribeLookHouseVo> page = subscribeLookHouseMapper.getSubscribeLookHouseList(sub);

        HashMap<String,Object> map = new HashMap<>();
        map.put("data",page.getResult());
        map.put("total",page.getTotal());

        return map;

    }

    @Override
    public void changeStates(int id, Integer states) {
        subscribeLookHouseMapper.changeStates(id,states);
    }

    @Override
    public void changeExpediteStates(int id, Integer expediteStates) {
        subscribeLookHouseMapper.changeExpediteStates(id,expediteStates);
    }
}
